package com.youyi.yyfilepickerlibrary.core.model;

import com.youyi.yychosesdk.utils.file.FileUtils;
import com.youyi.yyfilepickerlibrary.SDK.YYPickSDK;
import java.io.File;
import java.io.FileFilter;

public class EssFileFilter implements FileFilter {
    private String[] mTypes;

    public EssFileFilter(String[] strArr) {
        this.mTypes = strArr;
    }

    public boolean accept(File file) {
        if (file.isDirectory() && !file.isHidden()) {
            return true;
        }
        if (!YYPickSDK.isAll) {
            String[] strArr = this.mTypes;
            if (strArr == null || strArr.length <= 0) {
                return true;
            }
            for (String str : strArr) {
                if ((file.getName().endsWith(str.toLowerCase()) || file.getName().endsWith(str.toUpperCase())) && !file.isHidden()) {
                    return true;
                }
            }
            return false;
        } else if (file.getName().startsWith(FileUtils.HIDDEN_PREFIX)) {
            return false;
        } else {
            return true;
        }
    }
}
